class Myque:
    def __init__(self):
        self.st1=[]
        self.st2=[]

    def appendTail(self,val):
        self.st1.append(val)

    def deleteHead(self):
        while len(self.st1)>1:
            self.st2.append(self.st1.pop())
        if len(self.st1)>0: res=self.st1.pop()
        else: res=None 
        while len(self.st2)>0:
            self.st1.append(self.st2.pop())
        return res 
    
def solve(lst1,lst2):
    que=Myque()
    ans=[]
    for i,x in enumerate(lst1):
        if x=='appendTail':
            que.appendTail(lst2[i])
        else:
            ans.append(que.deleteHead())
    return ans

lst1=['appendTail','appendTail','deleteHead','appendTail','deleteHead','deleteHead']
lst2=[1,2,None,3,None,None]
print(solve(lst1,lst2))

